package com.athena.process
{
	import flash.display.MovieClip;
	import flash.display.*;
	import flash.utils.*;
	import flash.events.*;
	/**
	 * ...
	 * @author ...
	 */
	public class ShopFunction 
	{
		public static function AG_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_btn.gotoAndStop(2) ;
			mc.LQ_btn.gotoAndStop(1) ;
			mc.AG_mc.visible = true ;
			mc.LQ_mc.visible = false ;			
		}
		public static function LQ_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_btn.gotoAndStop(1) ;
			mc.LQ_btn.gotoAndStop(2) ;
			mc.AG_mc.visible = false ;
			mc.LQ_mc.visible = true ;
		}
		/**************************** AG ***************************************/
		public static function Bangdan_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_mc.Bangdan_mc.visible = true ;
			mc.AG_mc.Kick_mc.visible = false ;
			mc.AG_mc.Gobobangdan_mc.visible = false ;
			mc.AG_mc.Chongkick_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Cấm chat, cấm gửi emotion" ;
		}
		public static function Kick_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_mc.Bangdan_mc.visible = false ;
			mc.AG_mc.Kick_mc.visible = true ;
			mc.AG_mc.Gobobangdan_mc.visible = false ;
			mc.AG_mc.Chongkick_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Được kick cao thủ trên mình" ;
		}
		public static function Gobobangdan_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_mc.Bangdan_mc.visible = false ;
			mc.AG_mc.Kick_mc.visible = false ;
			mc.AG_mc.Gobobangdan_mc.visible = true ;
			mc.AG_mc.Chongkick_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Gỡ băng dán, tiếp tục chat" ;
		}
		public static function Chongkick_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.AG_mc.Bangdan_mc.visible = false ;
			mc.AG_mc.Kick_mc.visible = false ;
			mc.AG_mc.Gobobangdan_mc.visible = false ;
			mc.AG_mc.Chongkick_mc.visible = true ;
			mc.AG_mc.Note_txt.htmlText = "Ít * nhưng có thể được vào bất kỳ bàn nào nếu đủ AG" ;
		}
		/**************************************** LQ ***************************************************/
		public static function Chienthu_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = true ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Bắt đối thủ phải đánh thêm 1 ván" ;
		}
		public static function Ngoisao_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = true ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Được X2 nếu mình thắng" ;
		}
		public static function Lenhbai_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = true ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Bắt đối thủ phải nhận, phải theo" ;
		}
		public static function Thubocuoc_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = true ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Xin ra khỏi bàn" ;
		}
		public static function Giaithoatx2_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = true ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			mc.AG_mc.Note_txt.htmlText = "Hóa giải ngôi sao may mắn" ;
		}
		public static function Thucauhoa_click(evt:MouseEvent) { 
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = true ;
			mc.AG_mc.Note_txt.htmlText = "Hóa giải lệnh bài quyết đấu" ;
		}
		
		public static function Close_click(evt:MouseEvent) { //Xu ly Kick Close tren popup chuyen tien
			BasicFunction.SoundKick() ;
			var tmpLD : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Loading"));
			while (tmpLD != null) {
				Cotuong.mainStage_mc.removeChild(tmpLD) ;
				tmpLD = MovieClip(Cotuong.mainStage_mc.getChildByName("Loading"));
			}
			var mc : MovieClip = MovieClip(Cotuong.mainStage_mc.getChildByName("Shop")) ;
			if (mc == null) return ;
			Cotuong.mainStage_mc.removeChild(mc) ;			
		}
		
		
		public static function Shop_Click(evt : MouseEvent) {
			var mc : MovieClip = MovieClip(new Popup_Shop()) ;
			mc.Close_btn.addEventListener(MouseEvent.CLICK, Close_click);
			mc.AG_btn.addEventListener(MouseEvent.CLICK, AG_click);
			mc.LQ_btn.addEventListener(MouseEvent.CLICK, LQ_click);
			mc.AG_btn.gotoAndStop(2) ;
			mc.LQ_btn.gotoAndStop(1) ;
			mc.AG_mc.visible = true ;
			mc.LQ_mc.visible = false ;
			
			mc.AG_mc.Bangdan_btn.addEventListener(MouseEvent.CLICK, Bangdan_click) ;
			mc.AG_mc.Kick_btn.addEventListener(MouseEvent.CLICK, Kick_click) ;
			mc.AG_mc.Gobobangdan_btn.addEventListener(MouseEvent.CLICK, Gobobangdan_click) ;
			mc.AG_mc.Chongkick_btn.addEventListener(MouseEvent.CLICK, Chongkick_click) ;
			
			mc.LQ_mc.Chienthu_btn.addEventListener(MouseEvent.CLICK, Chienthu_click) ;
			mc.LQ_mc.Ngoisao_btn.addEventListener(MouseEvent.CLICK, Ngoisao_click) ;
			mc.LQ_mc.Lenhbai_btn.addEventListener(MouseEvent.CLICK, Lenhbai_click) ;
			mc.LQ_mc.Thubocuoc_btn.addEventListener(MouseEvent.CLICK, Thubocuoc_click) ;
			mc.LQ_mc.Giaithoatx2_btn.addEventListener(MouseEvent.CLICK, Giaithoatx2_click) ;
			mc.LQ_mc.Thucauhoa_btn.addEventListener(MouseEvent.CLICK, Thucauhoa_click) ;
			
			mc.LQ_mc.Chienthu_mc.visible = false ;
			mc.LQ_mc.Ngoisao_mc.visible = false ;
			mc.LQ_mc.Lenhbai_mc.visible = false ;
			mc.LQ_mc.Thubocuoc_mc.visible = false ;
			mc.LQ_mc.Giaithoatx2_mc.visible = false ;
			mc.LQ_mc.Thucauhoa_mc.visible = false ;
			
			mc.AG_mc.Bangdan_mc.visible = false ;
			mc.AG_mc.Kick_mc.visible = false ;
			mc.AG_mc.Gobobangdan_mc.visible = false ;
			mc.AG_mc.Chongkick_mc.visible = false ;
			var tmpLD:MovieClip = MovieClip(new Loading());
			tmpLD.name = "Loading";
			tmpLD.x = 340;
			tmpLD.y = 250;			
			Cotuong.mainStage_mc.addChild(tmpLD);
			mc.name = "Shop" ;
			mc.x = 150 ;
			mc.y = 120 ;
			Cotuong.mainStage_mc.addChild(mc) ;
		}
	}
	
}